/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package BESA.util;

import BESA.SystemLevel.AdmBESA;
import java.util.ArrayList;

/**
 *
 * @author Andrea
 */
public class Log {
    private ArrayList<String> Log;
    private int numMsg;
    private String tittle;
    public Log(String tittle){
        Log=new ArrayList<String>();
        numMsg=1;
        this.tittle=tittle;
    }

    public void add(String msg){
        Log.add((numMsg++)+" "+pretty(msg));
    }
    public void addLine(String msg){
        Log.add((numMsg++)+" "+msg);
    }

    public void print(){
        System.out.println("\n\n----------------------------"+tittle+"----------------------------");
        for (int i = 0; i < Log.size(); i++) {
            System.out.println(Log.get(i));
        }
        System.out.println("\n\n");
    }

    private String pretty(String msg) {
        return msg.replaceAll(AdmBESA.MULTICAST_DELIMITER, "\t");
    }

}
